﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Xejen.Communication.Http
{
    /// <summary>
    /// 表示http请求地址
    /// </summary>
    /// <creator>marc</creator>
    public class HttpAddress
    {
        /// <summary>
        /// 地址
        /// </summary>
        public string RequestUri { get; set; } = string.Empty;

        /// <inheritdoc cref="HttpAddress"/>
        public HttpAddress() { }

        /// <inheritdoc cref="HttpAddress"/>
        /// <param name="requestUri"><inheritdoc cref="RequestUri" path="/summary"/></param>
        public HttpAddress(string requestUri)
        {
            RequestUri = requestUri;
        }

        /// <inheritdoc/>
        public override string ToString()
        {
            return $"{nameof(HttpAddress)}:{RequestUri}";
        }

        /// <inheritdoc/>
        public override int GetHashCode()
        {
            return (RequestUri).GetHashCode();
        }

        /// <inheritdoc/>
        public override bool Equals(object obj)
        {
            var target = obj as HttpAddress;
            return RequestUri.ToLower() == target.RequestUri.ToLower();
        }
    }
}
